/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Server.DTO;

import Server.BUS.StringUlti;

/**
 *
 * @author Trung
 */
public class SelectHaveWhereQuery extends SelectQuery{
    private String whereString;
    
    public SelectHaveWhereQuery()
    {
        super();
        whereString = "";
    }
    
    public SelectHaveWhereQuery(String _queryString)
    {
        this.keyWord = "SELECT_HAVEWHERE";
        this.queryString = StringUlti.formatString(_queryString);
        
        int begin = this.queryString.indexOf("SELECT") + "SELECT".length();
        int end = this.queryString.indexOf("FROM") - 1;
        
        this.selectString = this.queryString.substring(begin, end);
        this.selectString = this.selectString.trim();
        
        begin = this.queryString.indexOf("FROM") + "FROM".length();
        end = this.queryString.indexOf("WHERE") - 1;
        this.fromString = this.queryString.substring(begin, end);
        this.fromString = this.fromString.trim();
        
        begin = this.queryString.indexOf("WHERE") + "WHERE".length();
        this.whereString = this.queryString.substring(begin);
        this.whereString = this.whereString.trim();
               
    }

    /**
     * @return the whereString
     */
    public String getWhereString() {
        return whereString;
    }

    /**
     * @param whereString the whereString to set
     */
    public void setWhereString(String whereString) {
        this.whereString = whereString;
        this.whereString = StringUlti.formatString(this.whereString);
    }
}
